package com.tr.rentcar.controller.houtai.usermanage;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.sun.java.swing.plaf.windows.resources.windows;
import com.tr.rentcar.model.bean.User;
import com.tr.rentcar.model.dao.UserDao;

@WebServlet("/houtaiusermodify")
public class UsermodifyController extends HttpServlet{
    User User=new User();
    UserDao UserDao=new UserDao();
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		try {
			req.setCharacterEncoding("utf-8");
		String id=req.getParameter("id");
		long uid=Long.parseLong(id);
		String uname=req.getParameter("uname");
		String utel=req.getParameter("utel");
		String uemail=req.getParameter("uemail");
		String selectName=req.getParameter("selectName");
		Integer ustate;
		if(selectName.equals("冻结"))
			ustate=0;
		else
			ustate=1;
		
		if(UserDao.updateuser(uname, utel, uemail,ustate,uid)){
				
			}
		
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		resp.sendRedirect(req.getContextPath()+"/houtaiuser");
		
	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}

}
